package design_pattern.factory.test2;

/**
 * Created by WeiDingKuo on 2017/10/26 13:33
 *
 * 工厂模式
 * 每个产品有一个自己的工厂
 * 当产品种类增加时，不需要修改原有工厂类，只需要新建一个工厂类和对应产品类就ok
 */
public class Test {
    public static void main(String[] args) {
        Factory factory1 = new FactoeryImpl1();
        Product product1 = factory1.getProduct();

        Factory factory2 = new FactoeryImpl2();
        Product product2 = factory2.getProduct();

        product1.dosomething1();
        product1.dosomething2();

        System.out.println("==========");

        product2.dosomething1();
        product2.dosomething2();
    }
}
